use std::env;
use windows::{
    core::{HSTRING, PCWSTR},
    Win32::UI::WindowsAndMessaging::*
};

pub fn get_os()->OsType{
    let current_os = env::consts::OS;
    if current_os=="windows"{
        return OsType::Windows;
    }
    if current_os=="linux"{
        return OsType::Linux;
    }
    return OsType::Other;
}
pub enum OsType {
    Windows,
    Linux,
    Other
}

pub struct Windows{}

impl Windows{
    pub fn show_windows_msg_ok_and_cancel(title:&str,msg:&str)->bool{
        unsafe {
             let htitle = HSTRING::from(title);
             let hmsg = HSTRING::from(msg);
             let foreground_hwnd=GetForegroundWindow();
             let msg_re = MessageBoxW(
                foreground_hwnd,
                PCWSTR::from_raw(hmsg.as_ptr()),
                PCWSTR::from_raw(htitle.as_ptr()),
                MB_OKCANCEL,
            );
            return msg_re.0==1;
        };
    }
}